package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户-判断是否微信用用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 登录用户为新用户，保存用户信息。完成注册
     * @param user
     */
    void insert(User user);

    //根据id查询用户根据id查询用户
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    //查询每天新用户数量
    Integer getNewUserCount(LocalDateTime endTime, LocalDateTime beginTime);

    //查询每天总用户数量
    Integer gettotalUserCount(LocalDateTime beginTime);
}
